<!-- 规则管理 分红结算规则 详情 -->
<template>
	<div>
		<el-breadcrumb  separator="/" class="bread-title">
		   <el-breadcrumb-item :to="{ path: '/dividendRule' }">分红结算规则</el-breadcrumb-item>
		   <el-breadcrumb-item>详情</el-breadcrumb-item>
		</el-breadcrumb>

		<p style="margin-top: 40px"> 规则名称：{{shareOutDetail.name}} </p>
		<p> 计算类型：{{shareOutDetail.type == 1?'利润率':'利润额'}}</p>
		<p> 分红单位：{{shareOutDetail.dividendUnit == 1?'百分比(%)':'金额（元)'}} </p>

		<el-row type="flex" class="row-bg" style="margin-top: 40px">
			<el-col :span="2">区间设置：</el-col>
			<el-col :span="12">
				<el-table :data="sections" border >
				    <el-table-column label="利润计算区间" :formatter="initinterval" prop="profitBegin" align="center">
				    </el-table-column>
				    <el-table-column label="利润分配" prop="profitProportion"  align="center">
				    	<template slot-scope="scope">
				    		{{scope.row.profitProportion}}{{shareOutDetail.dividendUnit==1?'%':'元'}}
				    	</template>
				    </el-table-column>
				    <el-table-column label="激励基数" prop="profitBase" align="center">
				    	<template slot-scope="scope">
				    		{{scope.row.profitBase==1?'营收业绩':''}}
				    	</template>
				    </el-table-column>
				    <el-table-column label="激励分配" prop="distributionProportion" align="center">
					   <template slot-scope="scope">
					   	{{scope.row.distributionProportion}}{{shareOutDetail.dividendUnit==1?'%':'元'}}
					   </template>
				    </el-table-column>
				</el-table>
			</el-col>
		</el-row>

		<el-row type="flex" class="row-bg" style="margin-top: 40px">
			<el-col :span="2">操作记录：</el-col>
			<el-col :span="12">
				<el-table :data="logInfo" border >
				    <el-table-column label="操作" prop="operationInfo" align="center">
				    </el-table-column>
				    <el-table-column label="操作人" prop="operationUsername"  align="center">
				    </el-table-column>
				    <el-table-column label="角色" prop="roleName" align="center">
				    </el-table-column>
				    <el-table-column label="时间" prop="createDate" align="center">
				    </el-table-column>
				    <el-table-column label="备注" prop="remark" align="center">
				    </el-table-column>
				</el-table>
			</el-col>
		</el-row>

		<el-button type="primary"style="margin:20px 30%;" @click="cancelhander">关闭</el-button>
	</div>

</template>

<script>
	import api from '@/api/apiPath'
	export default {
	    data() {
	        return {
	        	id:this.$route.query.id,
	        	shareOutDetail:{},//详情信息
	        	sections:[],
	        	logInfo:[],
	        }
	    },
	    created(){
	    	this.getdata()
	    },
	    methods:{
	    	initinterval(row, column, cellValue, index){
	    	    let str =''
	    	    if (!row.profitBegin) {
	    	        str = '<'+row.profitEnd + (this.shareOutDetail.type==1?'%':'元')
	    	    }else if(row.profitBegin && row.profitEnd){
	    	        str =  row.profitBegin + (this.shareOutDetail.type==1?'%':'元')+'(含) -'+ row.profitEnd+ (this.shareOutDetail.type==1?'%':'元') +'(不含）'
	    	    }else if(!row.profitEnd){
	    	        str = '≥'+row.profitBegin + (this.shareOutDetail.type==1?'%':'元')
	    	    }
	    	    return str
	    	},
	    	getdata(){
	    		this.axios.get(api.INVESTSHAREDETAIL+'/'+this.id).then(res =>{
	    			if (res.data.code == 200) {
	    				this.shareOutDetail = res.data.data.shareOutDetail
	    				this.sections = res.data.data.sections
	    				this.logInfo = res.data.data.logInfo
	    			}
	    		})
	    	},
	    	cancelhander(){
	    		this.$router.go(-1)
	    	}
	    }
	}
</script>
<style lang="stylus">
	

</style>
